<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>

</style>
<body>
  
</body>
<script src="./js/时间模板.js"></script>
<script>

  function code(){
    let time = new Date();
    let year = time.getFullYear() + "",
        month = time.getMonth() + 1 + "" ,
        day = time.getDate() + "",
        hours = time.getHours() + "",
        minutes = time.getMinutes() + "";
        seconds = time.getSeconds() + "";
    function tft(value){
      return value.length < 2 ? "0" + value : value
    }
    let print = `${year}年${tft(month)}月${tft(day)}日 ${tft(hours)}时${tft(minutes)}分${seconds}秒`;
    console.log(print);
  }
  setInterval(() => {
    code();
  }, 1000);

  



</script>
</html>